<%@page import="models.DomainModel"%>
<%@page import="helpers.PaginatorHelper"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="java.util.ArrayList"%>
<%
	ArrayList<DomainModel> domains = (ArrayList<DomainModel>) request.getAttribute("domains");
	int pages = (Integer) request.getAttribute("page");
	boolean nextPage = (Boolean) request.getAttribute("nextPage");
	boolean prevPage = (Boolean) request.getAttribute("prevPage");
	PaginatorHelper paginator = (PaginatorHelper) request.getAttribute("paginator");
%>
<jsp:include page="/admin/layouts/header.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>
<script type="text/javascript" src="/admin/js/list_form.js"></script>
<script type="text/javascript" src="/admin/js/list_blacklist_domain.js"></script>
<script type="text/javascript">
<!--
var server = "<%=UrlHelper.getServerUrl(request)%>";
//-->
</script>
				<div class="block">
					<form id="multiselect_list" name="multiselect_list" method="post" action="">
						<table id="example" class="display" width="100%" cellspacing="0" cellpadding="0" border="0" name="example" style="width: 1187px;">
							<thead>
								<tr>
									<th style="width: 45px;">Id</th>
									<th>Website</th>
									<th style="width: 147px;">Status</th>
								</tr>
							</thead>
							<tbody>
								<% for (int i = 0; i < domains.size(); i++) { %>
								<tr id="<%=i+1%>">
									<td>
										<input type="checkbox" id="categ_<%=i+1%>" name="categ_<%=domains.get(i).getDomain() %>">&nbsp;<%=i+1%>
										<input type="hidden" class="blacklist-domain" value="<%=domains.get(i).getDomain() %>" />
									</td>
									<td>
										<a onclick="return false;" class="user-link" title="<%=domains.get(i).getDomain() %>" href="#" id="domain-<%=i+1%>"><%=domains.get(i).getDomain() %></a>
										<a onclick="return false;" class="more-info-categ" id="more-info-categ-<%=i+1%>" title="View full info of this website" href="#"><span>More info</span></a>
									</td>
									<td>
										<%
										switch (domains.get(i).getStatus()) {
											case -1: 
												%>Blacklist<%
												break;
											case 1:
												%>Normal<%
												break;
											default:
												break;
										}
										%>
									</td>
								</tr>
								<% } %>
							</tbody>
						</table>
						
						<table id="multiple_controls" class="list">
							<thead>
								<tr><th colspan="2" class="listHeader">Manage multiple selections</th></tr>
							</thead>
							<tbody>
								<tr>
									<td>
										<fieldset class="link_action">
											<legend>Select</legend>
											<input type="button" class="button" value="Check All" id="check_all" name="check_all">
											<input type="button" class="button" value="Uncheck All" id="uncheck_all" name="uncheck_all">
										</fieldset>
										<fieldset class="link_action">
											<legend>Action</legend>
											<input type="button" class="button" title="Remove selected links! Note: links can not be restored after removal!" value="Remove Blacklist" id="removeButton" name="remove">
										</fieldset>
									</td>
								</tr>
							</tbody>
						</table>
					</form>
				</div>
				
<div style="display: none;" class="hide-paginate">
	<div class="paginate" style="text-align: right;">
	<% if (prevPage) { %>
		<a class="next fg-button ui-state-default" href="<%=paginator.getPrev()%>">Prev</a>
	<% } else { %>
		<span class="prev fg-button ui-state-default ui-state-disabled">Prev</span>
	<% } %>
	<% if (nextPage) { %>
		<a class="next fg-button ui-state-default" href="<%=paginator.getNext()%>">Next</a>
	<% } else { %>
		<span class="next fg-button ui-state-default ui-state-disabled">Next</span>
	<% } %>
	</div>
</div>
<jsp:include page="/admin/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>